﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Cat.Helper
{
    class Str_helper
    {
        /// <summary>
        /// 过滤非法字符
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public  string ReplaceBadChar(string str)
        {
            if (string.IsNullOrEmpty(str))
                return "";
          
            StringBuilder rBuilder = new StringBuilder(str);

            foreach (char rInvalidChar in Path.GetInvalidFileNameChars())
                rBuilder.Replace(rInvalidChar.ToString(), string.Empty);

            str = rBuilder.ToString();
            return str;
        }
    }
}
